<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Ajax_geo extends Frontend_Controller {

    function __construct() {
        parent::__construct();
        if (!$this->input->is_ajax_request()) {
            die;
        }
    }

    public function index() {
        die;
    }

    function get_geo_by_parent_id_to_select_box() {
        $parent_id = intval($this->input->post('parent_id'));
        if ($parent_id) {
            $arr_result = $this->geo_model->get_by_parent_id($parent_id);
            $data = array('array_geo' => $arr_result);
            $html = $this->load->view('geo_select_box', $data, TRUE);

            $arr_json = array();
            $arr_json['status'] = 'success';
            $arr_json['html'] = $html;
            echo json_encode($arr_json);
        }
    }

}
